﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Globalization;

namespace WiiRegionChanger
{
    public partial class wadForm : Form
    {

        string path2, filename2;

        public wadForm()
        {
            InitializeComponent();
        }


        private void openWadVCToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd2 = new OpenFileDialog();
            ofd2.Title = "Open file...";
            ofd2.Filter = "WAD files (*.wad)|*.wad|All files (*.*)|*.*";
            ofd2.Multiselect = false;

            if (ofd2.ShowDialog() == DialogResult.OK)
            {
                //clear all the stuff

                //load the wad filename
                wadFilenameTextBox.Text = ofd2.FileName;
            }

            if (wadFilenameTextBox.Text != "")
            {
                path2 = wadFilenameTextBox.Text;
                filename2 = wadFilenameTextBox.Text.Substring(wadFilenameTextBox.Text.LastIndexOf('\\') + 1);
                patchWadVCToolStripMenuItem.Enabled = true;
                patchWadButton.Enabled = true;

                loadwadfile();



            }


        }

        private void wadForm_Load(object sender, EventArgs e)
        {
            patchWadVCToolStripMenuItem.Enabled = false;
            patchWadButton.Enabled = false;
            newRegionCodeTextBox.Enabled = false;
            newRegionStringTextBox.Enabled = false;

            newRegionStringComboBox.Items.Add("USA - GENERIC");
            newRegionStringComboBox.Items.Add("JAP - GENERIC");
            newRegionStringComboBox.Items.Add("PAL - GENERIC");
            newRegionStringComboBox.Items.Add("Region Free");

            newRegionCodeTextBox.Text = "0001";
            newRegionStringComboBox.SelectedIndex = 0;
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newRegionStringComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
             int x;
            x = newRegionStringComboBox.SelectedIndex;

            switch (x)
            {
                case 0:
                    //USA
                    newRegionCodeTextBox.Text = "0001";
                    newRegionStringTextBox.Text = "80 06 80 80 80 80 80 80 80 80 80 80 80 80 80 80";
                    break;

                case 1:
                    //JAP
                    newRegionCodeTextBox.Text = "0000";
                    newRegionStringTextBox.Text = "00 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80";
                    break;

                case 2:
                    //PAL
                    newRegionCodeTextBox.Text = "0002";
                    newRegionStringTextBox.Text = "80 80 80 00 03 03 04 03 00 80 80 80 80 80 80 80";
                    break;

                case 3:
                    //Region Free
                    newRegionCodeTextBox.Text = "0003";
                    newRegionStringTextBox.Text = "80 06 80 80 80 80 80 80 80 80 80 80 80 80 80 80";
                    break;

                default:
                    //error handling
                    newRegionCodeTextBox.Text = "??";
                    newRegionStringTextBox.Text = "????????????????????????????????";
                    break;

            }
        }

        private void patchWadButton_Click(object sender, EventArgs e)
        {
            int errorCounterInt = 0;
            //1. write the new region string
            //0x4E010 (319504d) - 0x4E01F (319519d)
            string regionPatchValueString, regionPatchValueString2;

            regionPatchValueString = newRegionStringTextBox.Text;
            //get rid of spaces
            regionPatchValueString2 = regionPatchValueString.Replace(" ", "");


            //setup arrays
            string[] rpvs = new string[32];
            byte[] rpvsb = new byte[32];
            int[] rpvsd = new int[32];
            string[] rpvs_final = new string[32];

            //split it up into twos
            rpvs[0] = regionPatchValueString2[0].ToString() + regionPatchValueString2[1].ToString();
            rpvs[1] = regionPatchValueString2[2].ToString() + regionPatchValueString2[3].ToString();
            rpvs[2] = regionPatchValueString2[4].ToString() + regionPatchValueString2[5].ToString();
            rpvs[3] = regionPatchValueString2[6].ToString() + regionPatchValueString2[7].ToString();
            rpvs[4] = regionPatchValueString2[8].ToString() + regionPatchValueString2[9].ToString();
            rpvs[5] = regionPatchValueString2[10].ToString() + regionPatchValueString2[11].ToString();
            rpvs[6] = regionPatchValueString2[12].ToString() + regionPatchValueString2[13].ToString();
            rpvs[7] = regionPatchValueString2[14].ToString() + regionPatchValueString2[15].ToString();
            rpvs[8] = regionPatchValueString2[16].ToString() + regionPatchValueString2[17].ToString();
            rpvs[9] = regionPatchValueString2[18].ToString() + regionPatchValueString2[19].ToString();
            rpvs[10] = regionPatchValueString2[20].ToString() + regionPatchValueString2[21].ToString();
            rpvs[11] = regionPatchValueString2[22].ToString() + regionPatchValueString2[23].ToString();
            rpvs[12] = regionPatchValueString2[24].ToString() + regionPatchValueString2[25].ToString();
            rpvs[13] = regionPatchValueString2[26].ToString() + regionPatchValueString2[27].ToString();
            rpvs[14] = regionPatchValueString2[28].ToString() + regionPatchValueString2[29].ToString();
            rpvs[15] = regionPatchValueString2[30].ToString() + regionPatchValueString2[31].ToString();

            //convert the chars to int32, then to string, then byte again
            int q = 0;
            while (q <= 15)
            {
                rpvsd[q] = int.Parse(rpvs[q], System.Globalization.NumberStyles.HexNumber);
                rpvs_final[q] = rpvsd[q].ToString();
                rpvsb[q] = byte.Parse(rpvs_final[q]);
                q++;
            }

            FileStream fs99 = new FileStream(@path2, FileMode.Open, FileAccess.Write);
            long offset99 = fs99.Seek(3742, SeekOrigin.Begin);   // Seek to 3742th byte in the file
            //this is converting to hex before it writes
            q = 0;
            while (q <= 15)
            {
                fs99.WriteByte(rpvsb[q]);
                q++;
            }

            fs99.Close();





            string newRegionCodeString;
            newRegionCodeString = "01"; //default usa
            
            //2.Write the new region code
            if (newRegionCodeTextBox.Text == "0000")
            {
                newRegionCodeString = "00"; //jap
            }
            else if (newRegionCodeTextBox.Text == "0001")
            {
                newRegionCodeString = "01"; //usa
            }
            else if (newRegionCodeTextBox.Text == "0002")
            {
                newRegionCodeString = "02"; //pal
            }
            else if (newRegionCodeTextBox.Text == "0003")
            {
                newRegionCodeString = "03"; //rf
            }
            else
            {
                MessageBox.Show("Invalid region code!", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                errorCounterInt = 1;
            }

            string[] nrcs = new string[2];
            byte[] nrcsb = new byte[2];
            int[] nrcsd = new int[2];
            string[] nrcss_final = new string[2];

            nrcs[0] = newRegionCodeString;

            nrcsd[0] = int.Parse(nrcs[0], System.Globalization.NumberStyles.HexNumber);
            nrcss_final[0] = nrcsd[0].ToString();
            nrcsb[0] = byte.Parse(nrcss_final[0]);
            
            FileStream fs98 = new FileStream(@path2, FileMode.Open, FileAccess.Write);
            long offset98 = fs98.Seek(3805, SeekOrigin.Begin);   // Seek to 3805th byte in the file
            fs98.WriteByte(nrcsb[0]);
            
            fs98.Close();


            if (errorCounterInt == 0)
            {
                MessageBox.Show("WAD files successfully patched! Reload WAD file to see changes.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                patchWadButton.Enabled = false;
            }
            else
            {
            }

        }

        private void loadwadfile()
        {
            //1.get wad game code (offset 3728, 4 bytes)
            string gc, gcComplete = "", gc_firstThree = "", gc_lastOne = "";
            int x = 0;
            //gonna need a try/catch here in case the file is in use
            FileStream fs97 = new FileStream(@path2, FileMode.Open, FileAccess.Read);
            long offset97 = fs97.Seek(3728, SeekOrigin.Begin);   // Seek to 3728th byte in the file

            while (x < 4)
            {
                gc = fs97.ReadByte().ToString("X");
                //if length is single digit add a 0 ( 1 now is 01)
                if (gc.Length == 1)
                {
                    gc = "0" + gc;
                }
                
                //convert the hex to ascii
                char gc_ascii = (char)Int32.Parse(gc, NumberStyles.AllowHexSpecifier);

                gcComplete += gc_ascii;
                if (x < 3)
                {
                //so we can just get the first 3 for identification below
                    gc_firstThree += gc_ascii;
                }
                if (x > 2)
                {
                    gc_lastOne += gc_ascii;
                }
                x = x + 1;
            }
            
            fs97.Close();

            gamecodeTextBox.Text = gcComplete;

            if (gc_firstThree == "C95")
            {
                gameNameTextBox.Text = "Impossible Mission";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "C97")
            {
                gameNameTextBox.Text = "California Games";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "C98")
            {
                gameNameTextBox.Text = "Paradroid";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "C99")
            {
                gameNameTextBox.Text = "Uridium";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "C9X")
            {
                gameNameTextBox.Text = "The Last Ninja";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "C9Y")
            {
                gameNameTextBox.Text = "International Karate";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "C9Z")
            {
                gameNameTextBox.Text = "World Games";
                platformTextBox.Text = "Commodore 64";
            }
            else if (gc_firstThree == "EAA")
            {
                gameNameTextBox.Text = "Fatal Fury";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAB")
            {
                gameNameTextBox.Text = "World Heroes";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAC")
            {
                gameNameTextBox.Text = "Magician Lord";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAD")
            {
                gameNameTextBox.Text = "Art of Fighting";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAF")
            {
                gameNameTextBox.Text = "Blue's Journey";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAG")
            {
                gameNameTextBox.Text = "The King of Fighters '94";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAH")
            {
                gameNameTextBox.Text = "Baseball Stars 2";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAI")
            {
                gameNameTextBox.Text = "Top Hunter";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "EAJ")
            {
                gameNameTextBox.Text = "Metal Slug";
                platformTextBox.Text = "NeoGeo";
            }
            else if (gc_firstThree == "FA6")
            {
                gameNameTextBox.Text = "Donkey Kong Jr. Math";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FA7")
            {
                gameNameTextBox.Text = "Mario & Yoshi";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FA8")
            {
                gameNameTextBox.Text = "Kirby's Adventure";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FA9")
            {
                gameNameTextBox.Text = "Zelda II: The Adventure of Link";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAA")
            {
                gameNameTextBox.Text = "Donkey Kong";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAB")
            {
                gameNameTextBox.Text = "Donkey Kong Jr.";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAC")
            {
                gameNameTextBox.Text = "Pinball";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAD")
            {
                gameNameTextBox.Text = "Gomoku Narabe Renju";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAF")
            {
                gameNameTextBox.Text = "Mario Bros.";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAG")
            {
                gameNameTextBox.Text = "Super Mario Bros.";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAH")
            {
                gameNameTextBox.Text = "Tennis";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAI")
            {
                gameNameTextBox.Text = "Soccer";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAJ")
            {
                gameNameTextBox.Text = "Ice Hockey";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAK")
            {
                gameNameTextBox.Text = "The Legend of Zelda";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAL")
            {
                gameNameTextBox.Text = "Baseball";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAM")
            {
                gameNameTextBox.Text = "Wario's Woods";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAN")
            {
                gameNameTextBox.Text = "Urban Champion";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAO")
            {
                gameNameTextBox.Text = "Solomon's Key";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAP")
            {
                gameNameTextBox.Text = "NES Open TOurnament Golf";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAQ")
            {
                gameNameTextBox.Text = "Ninja JaJaMaru-kun";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAR")
            {
                gameNameTextBox.Text = "Gradius";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAS")
            {
                gameNameTextBox.Text = "Xevious";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAT")
            {
                gameNameTextBox.Text = "THe Legend of Kage";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAV")
            {
                gameNameTextBox.Text = "Tecmo Bowl";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAW")
            {
                gameNameTextBox.Text = "Elevator Action";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FAX")
            {
                gameNameTextBox.Text = "Pac-Man";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FB2")
            {
                gameNameTextBox.Text = "Super Mario Bros.: The Lost Levels";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FB4")
            {
                gameNameTextBox.Text = "Lunar Pool";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FB5")
            {
                gameNameTextBox.Text = "Zanac";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBB")
            {
                gameNameTextBox.Text = "Mach Rider";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBC")
            {
                gameNameTextBox.Text = "Excitebike";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBD")
            {
                gameNameTextBox.Text = "Kid Icarus";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBE")
            {
                gameNameTextBox.Text = "Ice Climber";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBH")
            {
                gameNameTextBox.Text = "Castlevania";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBI")
            {
                gameNameTextBox.Text = "Punch-Out!! / Featuring Mr. Dream";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBJ")
            {
                gameNameTextBox.Text = "Mighty Bomb Jack";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBK")
            {
                gameNameTextBox.Text = "Teenage Mutant Ninja Turtles";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBL")
            {
                gameNameTextBox.Text = "Lode Runner";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBN")
            {
                gameNameTextBox.Text = "Ninja Gaiden";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBR")
            {
                gameNameTextBox.Text = "Galaga";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBS")
            {
                gameNameTextBox.Text = "Milon's Secret Castle";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBU")
            {
                gameNameTextBox.Text = "Adventures of Lolo";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBY")
            {
                gameNameTextBox.Text = "Super Mario Bros. 2";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FBZ")
            {
                gameNameTextBox.Text = "Metroid";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FC3")
            {
                gameNameTextBox.Text = "Bubble Bobble";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FC6")
            {
                gameNameTextBox.Text = "Star Tropics";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FC7")
            {
                gameNameTextBox.Text = "NES Play Action Football";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FC8")
            {
                gameNameTextBox.Text = "Castlevania II: Simon's Quest";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCA")
            {
                gameNameTextBox.Text = "Star Soldier";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCH")
            {
                gameNameTextBox.Text = "Flappy";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCN")
            {
                gameNameTextBox.Text = "Antarctic Adventure";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCP")
            {
                gameNameTextBox.Text = "Balloon Fight";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCQ")
            {
                gameNameTextBox.Text = "Ninja Gaiden II: The Dark Sword of Chaos";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCR")
            {
                gameNameTextBox.Text = "Adventure Island";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCS")
            {
                gameNameTextBox.Text = "Probotector II: Return of the Evil Forces";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCT")
            {
                gameNameTextBox.Text = "Mega Man";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCU")
            {
                gameNameTextBox.Text = "Volleyball";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCV")
            {
                gameNameTextBox.Text = "Wrecking Crew";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCW")
            {
                gameNameTextBox.Text = "Super Mario Bros. 3";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCY")
            {
                gameNameTextBox.Text = "Yoshi's Cookie";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FCZ")
            {
                gameNameTextBox.Text = "Kind's Knight";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FD2")
            {
                gameNameTextBox.Text = "Double Dragon";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FD6")
            {
                gameNameTextBox.Text = "Adventures of Lolo 2";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDA")
            {
                gameNameTextBox.Text = "Spelunker";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDF")
            {
                gameNameTextBox.Text = "Bases Loaded";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDG")
            {
                gameNameTextBox.Text = "Ghosts 'n Goblins";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDL")
            {
                gameNameTextBox.Text = "Ninja Gaiden III: The Ancient Ship of Doom";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDN")
            {
                gameNameTextBox.Text = "Mega Man 2";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDO")
            {
                gameNameTextBox.Text = "Operation Wolf";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDP")
            {
                gameNameTextBox.Text = "Blades of Steel";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDQ")
            {
                gameNameTextBox.Text = "Double Dribble";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDR")
            {
                gameNameTextBox.Text = "Skate or Die";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDT")
            {
                gameNameTextBox.Text = "Renegade";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FDV")
            {
                gameNameTextBox.Text = "River City Ransom";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FEC")
            {
                gameNameTextBox.Text = "Skykid";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "FEI")
            {
                gameNameTextBox.Text = "City Connection";
                platformTextBox.Text = "Nintendo (NES)";
            }
            else if (gc_firstThree == "JA4")
            {
                gameNameTextBox.Text = "Super Ghouls 'n Ghost";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JA7")
            {
                gameNameTextBox.Text = "ActRaiser";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JA8")
            {
                gameNameTextBox.Text = "Final Fight";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAA")
            {
                gameNameTextBox.Text = "Super Mario World ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAB")
            {
                gameNameTextBox.Text = "Mario’s Super Picross ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAC")
            {
                gameNameTextBox.Text = "F-Zero";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAD")
            {
                gameNameTextBox.Text = "The Legend of Zelda: A Link to the Past";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAE")
            {
                gameNameTextBox.Text = "Donkey Kong Country ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAF")
            {
                gameNameTextBox.Text = "SimCity";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAH")
            {
                gameNameTextBox.Text = "R-TYPE: THE Third Lightning";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAI")
            {
                gameNameTextBox.Text = "Super Castlevania IV ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAJ")
            {
                gameNameTextBox.Text = "Street Fighter II: The World Warrior ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAL")
            {
                gameNameTextBox.Text = "Contra III: The Alien Wars / Super Probotector: Alien Rebels";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAM")
            {
                gameNameTextBox.Text = "Gradius III";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAV")
            {
                gameNameTextBox.Text = "Super Metroid";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAW")
            {
                gameNameTextBox.Text = "Romance of the Three Kingdoms IV: Wall of Fire";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JAZ")
            {
                gameNameTextBox.Text = "The Legend of The Mystical Ninja";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JB3")
            {
                gameNameTextBox.Text = "Harvest Moon";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBA")
            {
                gameNameTextBox.Text = "Metal Marines";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBB")
            {
                gameNameTextBox.Text = "Super Street Fighter II: The New Challengers";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBC")
            {
                gameNameTextBox.Text = "Kirby's Dream Course ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBD")
            {
                gameNameTextBox.Text = "Donkey Kong Country 2: Diddy’s Kong Quest";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBI")
            {
                gameNameTextBox.Text = "Street Fighter II' Turbo: Hyper Fighting";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBK")
            {
                gameNameTextBox.Text = "Breath of Fire II ";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBL")
            {
                gameNameTextBox.Text = "Pac-Attack";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBP")
            {
                gameNameTextBox.Text = "Donkey Kong Country 3: Dixie Kong’s Double Trouble";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBQ")
            {
                gameNameTextBox.Text = "Kirby’s Ghost Trap";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBR")
            {
                gameNameTextBox.Text = "Vegas Stakes";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBS")
            {
                gameNameTextBox.Text = "Axelay";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBT")
            {
                gameNameTextBox.Text = "Super Turrican";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBW")
            {
                gameNameTextBox.Text = "Cybernator";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JBY")
            {
                gameNameTextBox.Text = "Super R-Type";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "JCA")
            {
                gameNameTextBox.Text = "DoReMi Fantasy: Milon's DokiDoki Adventure";
                platformTextBox.Text = "Super Nintendo (SNES)";
            }
            else if (gc_firstThree == "LAB")
            {
                gameNameTextBox.Text = "Fantasy Zone";
                platformTextBox.Text = "Sega Master System";
            }
            else if (gc_firstThree == "LAC")
            {
                gameNameTextBox.Text = "Wonder Boy";
                platformTextBox.Text = "Sega Master System";
            }
            else if (gc_firstThree == "MA3")
            {
                gameNameTextBox.Text = "Puyo Puyo 2";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MA6")
            {
                gameNameTextBox.Text = "Streets of Rage 2";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MA7")
            {
                gameNameTextBox.Text = "Shining in the Darkness";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MA8")
            {
                gameNameTextBox.Text = "Ecco: The Tides of Time";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAA")
            {
                gameNameTextBox.Text = "Altered Beast";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAB")
            {
                gameNameTextBox.Text = "Columns";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAC")
            {
                gameNameTextBox.Text = "Dr. Robotnik's Mean Bean Machine";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAD")
            {
                gameNameTextBox.Text = "Ecco the Dolphin";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAE")
            {
                gameNameTextBox.Text = "Golden Axe";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAF")
            {
                gameNameTextBox.Text = "Gunstar Heroes";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAG")
            {
                gameNameTextBox.Text = "Ristar";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAH")
            {
                gameNameTextBox.Text = "Sonic The Hedgehog";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAI")
            {
                gameNameTextBox.Text = "Space Harrier II";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAJ")
            {
                gameNameTextBox.Text = "ToeJam & Earl";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAL")
            {
                gameNameTextBox.Text = "Bonanza Bros.";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAM")
            {
                gameNameTextBox.Text = "Sword of Vermilion";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAO")
            {
                gameNameTextBox.Text = "Bio-Hazard Battle";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAP")
            {
                gameNameTextBox.Text = "Comix Zone";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAQ")
            {
                gameNameTextBox.Text = "Streets of Rage";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAR")
            {
                gameNameTextBox.Text = "The Story of Thor";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAS")
            {
                gameNameTextBox.Text = "VECTORMAN";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAT")
            {
                gameNameTextBox.Text = "Sonic Spinball";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAV")
            {
                gameNameTextBox.Text = "Wonder Boy in Monster World";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAW")
            {
                gameNameTextBox.Text = "Virtua Fighter 2";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAX")
            {
                gameNameTextBox.Text = "Alex Kidd in the Enchanted Castle";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAY")
            {
                gameNameTextBox.Text = "Alien Storm";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MAZ")
            {
                gameNameTextBox.Text = "ToeJam & Earl in Panic on Funkotron";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MB7")
            {
                gameNameTextBox.Text = "Mega Turrican";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MB8")
            {
                gameNameTextBox.Text = "Phantasy Star II";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBB")
            {
                gameNameTextBox.Text = "Sonic The Hedgehog 2";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBC")
            {
                gameNameTextBox.Text = "Kid Chameleon";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBD")
            {
                gameNameTextBox.Text = "Golden Axe II";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBE")
            {
                gameNameTextBox.Text = "Shining Force";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBF")
            {
                gameNameTextBox.Text = "Shinobi III: Return of the Ninja Master";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBG")
            {
                gameNameTextBox.Text = "Dynamite Headdy";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBI")
            {
                gameNameTextBox.Text = "Landstalker: Treasures of King Nole";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBJ")
            {
                gameNameTextBox.Text = "Ghouls'n Ghosts";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBK")
            {
                gameNameTextBox.Text = "Crack Down";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBL")
            {
                gameNameTextBox.Text = "ESWAT:City Under Siege";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBM")
            {
                gameNameTextBox.Text = "Sonic The Hedgehog 3";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBO")
            {
                gameNameTextBox.Text = "Golden Axe III";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBP")
            {
                gameNameTextBox.Text = "Super Thunder Blade";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBQ")
            {
                gameNameTextBox.Text = "Streets of Rage 3";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBR")
            {
                gameNameTextBox.Text = "Rolling Thunder 2";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBT")
            {
                gameNameTextBox.Text = "Alien Soldier";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBU")
            {
                gameNameTextBox.Text = "Sonic 3D Blast";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBW")
            {
                gameNameTextBox.Text = "Columns III: Revenge of Columns";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBX")
            {
                gameNameTextBox.Text = "Ecco Jr.";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBY")
            {
                gameNameTextBox.Text = "Light Crusader";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MBZ")
            {
                gameNameTextBox.Text = "Eternal Champions";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MCA")
            {
                gameNameTextBox.Text = "Gley Lancer";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MCB")
            {
                gameNameTextBox.Text = "POWERBALL";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "MCC")
            {
                gameNameTextBox.Text = "Phantasy Star III: Generations of Doom";
                platformTextBox.Text = "MegaDrive/Genesis";
            }
            else if (gc_firstThree == "NAA")
            {
                gameNameTextBox.Text = "Super Mario 64";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAB")
            {
                gameNameTextBox.Text = "Mario Kart 64";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAC")
            {
                gameNameTextBox.Text = "The Legend of Zelda: Ocarina of Time";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAD")
            {
                gameNameTextBox.Text = "Star Fox 64";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAE")
            {
                gameNameTextBox.Text = "Paper Mario";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAF")
            {
                gameNameTextBox.Text = "F-Zero X";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAH")
            {
                gameNameTextBox.Text = "Yoshi's Story";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAI")
            {
                gameNameTextBox.Text = "Wave Race 64";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAJ")
            {
                gameNameTextBox.Text = "Sin & Punishment";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAK")
            {
                gameNameTextBox.Text = "Pokémon Snap";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAM")
            {
                gameNameTextBox.Text = "Kirby 64: The Crystal Shards";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAN")
            {
                gameNameTextBox.Text = "Pokémon Puzzle League";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAO")
            {
                gameNameTextBox.Text = "1080°: TenEighty Snowboarding";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "NAS")
            {
                gameNameTextBox.Text = "Cruis'n USA";
                platformTextBox.Text = "Nintendo 64";
            }
            else if (gc_firstThree == "PA6")
            {
                gameNameTextBox.Text = "Bloody Wolf";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PA7")
            {
                gameNameTextBox.Text = "Alien Crush";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PA8")
            {
                gameNameTextBox.Text = "Ordyne";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PA9")
            {
                gameNameTextBox.Text = "Splatterhouse";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAA")
            {
                gameNameTextBox.Text = "Bomberman’93";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAB")
            {
                gameNameTextBox.Text = "Bonk's Adventure";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAC")
            {
                gameNameTextBox.Text = "Dungeon Explorer";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAD")
            {
                gameNameTextBox.Text = "R-TYPE";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAE")
            {
                gameNameTextBox.Text = "Super Star Soldier";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAF")
            {
                gameNameTextBox.Text = "Victory Run";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAH")
            {
                gameNameTextBox.Text = "Battle Lode Runner ";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAI")
            {
                gameNameTextBox.Text = "New Adventure Island";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAJ")
            {
                gameNameTextBox.Text = "Necromancer";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAK")
            {
                gameNameTextBox.Text = "Dragon's Curse";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAL")
            {
                gameNameTextBox.Text = "Soldier Blade";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAM")
            {
                gameNameTextBox.Text = "Neutopia";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAN")
            {
                gameNameTextBox.Text = "Military Madness";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAO")
            {
                gameNameTextBox.Text = "Final Soldier";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAV")
            {
                gameNameTextBox.Text = "Vigilante";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PAW")
            {
                gameNameTextBox.Text = "GALAGA '90";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PB2")
            {
                gameNameTextBox.Text = "Neutopia";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PB3")
            {
                gameNameTextBox.Text = "Devil's Crush";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PB6")
            {
                gameNameTextBox.Text = "Cratermaze";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PB8")
            {
                gameNameTextBox.Text = "Blazing Lazers";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PB9")
            {
                gameNameTextBox.Text = "World Sports Competition";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBA")
            {
                gameNameTextBox.Text = "Dragon Spirit ";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBD")
            {
                gameNameTextBox.Text = "Double Dungeons";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBE")
            {
                gameNameTextBox.Text = "Moto Roader";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBH")
            {
                gameNameTextBox.Text = "Bonk's Revenge";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBI")
            {
                gameNameTextBox.Text = "Bonk 3: Bonk's Big Adventure";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBJ")
            {
                gameNameTextBox.Text = "Samurai-Ghost";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBM")
            {
                gameNameTextBox.Text = "Legend of Hero Tonma";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBN")
            {
                gameNameTextBox.Text = "Ninja Spirit";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBS")
            {
                gameNameTextBox.Text = "Chew Man Fu";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBT")
            {
                gameNameTextBox.Text = "China Warrior";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBU")
            {
                gameNameTextBox.Text = "Bravoman";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBW")
            {
                gameNameTextBox.Text = "Air Zonk";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBX")
            {
                gameNameTextBox.Text = "Shockman";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PBZ")
            {
                gameNameTextBox.Text = "J.J. & JEFF";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCA")
            {
                gameNameTextBox.Text = "Silent Debuggers";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCB")
            {
                gameNameTextBox.Text = "Dead Moon";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCE")
            {
                gameNameTextBox.Text = "Power Golf";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCH")
            {
                gameNameTextBox.Text = "Drop Off";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCO")
            {
                gameNameTextBox.Text = "Psychosis";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCR")
            {
                gameNameTextBox.Text = "Break In";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCS")
            {
                gameNameTextBox.Text = "Digital Champ: Battle Boxing";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "PCV")
            {
                gameNameTextBox.Text = "World Class Baseball";
                platformTextBox.Text = "TurboGrafx-16 / Pc Engine";
            }
            else if (gc_firstThree == "QAA")
            {
                gameNameTextBox.Text = "Super Air Zonk";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAC")
            {
                gameNameTextBox.Text = "Cho Aniki";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAD")
            {
                gameNameTextBox.Text = "Gradius / Gofer No Yabou";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAF")
            {
                gameNameTextBox.Text = "The Dynastic Hero";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAG")
            {
                gameNameTextBox.Text = "Gate of Thunder";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAS")
            {
                gameNameTextBox.Text = "Lords of Thunder";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAT")
            {
                gameNameTextBox.Text = "Riot Zone";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAU")
            {
                gameNameTextBox.Text = "Monster Lair";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "QAW")
            {
                gameNameTextBox.Text = "Star Parodier";
                platformTextBox.Text = "TurboGrafx-CD";
            }
            else if (gc_firstThree == "WB6")
            {
                gameNameTextBox.Text = "TV Show King";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WBQ")
            {
                gameNameTextBox.Text = "Star Soldier R";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WBS")
            {
                gameNameTextBox.Text = "Pop";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WBW")
            {
                gameNameTextBox.Text = "Critter Round-Up";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WDF")
            {
                gameNameTextBox.Text = "Defend your Castle";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WDM")
            {
                gameNameTextBox.Text = "Dr. Mario & Germ Buster";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WFC")
            {
                gameNameTextBox.Text = "Final Fantasy - My Life as a King";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WLP")
            {
                gameNameTextBox.Text = "LONPOS";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WLW")
            {
                gameNameTextBox.Text = "LostWinds";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WPP")
            {
                gameNameTextBox.Text = "Family Table Tennis";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WTT")
            {
                gameNameTextBox.Text = "Toki Tori";
                platformTextBox.Text = "WiiWare";
            }
            else if (gc_firstThree == "WVC")
            {
                gameNameTextBox.Text = "V.I.P. Casino: Blackjack";
                platformTextBox.Text = "WiiWare";
            }
            else
            {
                gameNameTextBox.Text = "Unknown / Not Implemented Yet";
                platformTextBox.Text = "Unknown / Not Implemented Yet";
            }

            //2.get original region (offset 3731, 1 byte, ascii)
            if (gc_lastOne == "E")
            {
                originalRegionTextBox.Text = "USA";
            }
            else if (gc_lastOne == "J")
            {
                originalRegionTextBox.Text = "Japan";
            }
            else if (gc_lastOne == "P")
            {
                originalRegionTextBox.Text = "Europe/Australia (PAL)";
            }
            else if (gc_lastOne == "D")
            {
                originalRegionTextBox.Text = "Germany";
            }
            else if (gc_lastOne == "F")
            {
                originalRegionTextBox.Text = "France";
            }
            else if (gc_lastOne == "A")
            {
                originalRegionTextBox.Text = "All Regions";
            }
            else if (gc_lastOne == "L")
            {
                originalRegionTextBox.Text = "Limited (Region Free)";
            }
            else if (gc_lastOne == "N")
            {
                originalRegionTextBox.Text = "Import Game";
            }
            else
            {
                originalRegionTextBox.Text = "Unknown / Not Found";
            }


            //3.get maker code (offset 3736, 2 bytes, ascii)
            x = 0;
            string mc, mcComplete = "";

            FileStream fs96 = new FileStream(@path2, FileMode.Open, FileAccess.Read);
            long offset96 = fs96.Seek(3736, SeekOrigin.Begin);   // Seek to 3736th byte in the file

            while (x < 2)
            {
                mc = fs96.ReadByte().ToString("X");
                //if length is single digit add a 0 ( 1 now is 01)
                if (mc.Length == 1)
                {
                    mc = "0" + mc;
                }

                //convert the hex to ascii
                char mc_ascii = (char)Int32.Parse(mc, NumberStyles.AllowHexSpecifier);

                mcComplete += mc_ascii;
                
                x += 1;
            }
            fs96.Close();


            makerCodeTextBox.Text = mcComplete;

            wiidiscdata wiidiscdata1 = new wiidiscdata();

            wiidiscdata1.GetMakerCode(mcComplete);
            makerCodeCoTextBox.Text = wiidiscdata1.GetMakerCode(mcComplete);


            //4.get region string (offset 3741, 16 bytes)
            x = 0;
            string rs, rsComplete = "";

            FileStream fs95 = new FileStream(@path2, FileMode.Open, FileAccess.Read);
            long offset95 = fs95.Seek(3742, SeekOrigin.Begin);   // Seek to 3742th byte in the file

            while (x < 16)
            {
                rs = fs95.ReadByte().ToString("X");
                //if length is single digit add a 0 ( 1 now is 01)
                if (rs.Length == 1)
                {
                    rs = "0" + rs;
                }

                //convert the hex to ascii
                //char mc_ascii = (char)Int32.Parse(mc, NumberStyles.AllowHexSpecifier);

                rsComplete += rs + " ";

                x += 1;
            }
            fs95.Close();


            regionStringTextBox.Text = rsComplete;

            //5.get region code (offset 3804, 2 bytes)
            x = 0;
            string rc, rcComplete = "";

            FileStream fs94 = new FileStream(@path2, FileMode.Open, FileAccess.Read);
            long offset94 = fs94.Seek(3804, SeekOrigin.Begin);   // Seek to 3804th byte in the file

            while (x < 2)
            {
                rc = fs94.ReadByte().ToString("X");
                //if length is single digit add a 0 ( 1 now is 01)
                if (rc.Length == 1)
                {
                    rc = "0" + rc;
                }


                rcComplete += rc;

                x += 1;
            }
            fs94.Close();

            if (rcComplete == "0000")
            {
                rcComplete = "0000 [JAP]";
            }
            else if (rcComplete == "0001")
            {
                rcComplete = "0001 [USA]";
            }
            else if (rcComplete == "0002")
            {
                rcComplete = "0002 [PAL]";
            }
            else if (rcComplete == "0003")
            {
                rcComplete = "0003 [Region Free]";
            }
            else
            {
                rcComplete = "???? [Unknown Region]";
            }

            regionCodeTextBox.Text = rcComplete;

        }
    }
}
